package com.xnxkj.wx.micro.mch.service;

import com.xnxkj.wx.micro.mch.bean.message.request.StateMessage;
import com.xnxkj.wx.micro.mch.bean.message.request.SubmitMessage;
import com.xnxkj.wx.micro.mch.bean.message.response.CertificatesResultMessage;
import com.xnxkj.wx.micro.mch.bean.message.response.MediaUploadResultMessage;
import com.xnxkj.wx.micro.mch.bean.message.response.StateResultMessage;
import com.xnxkj.wx.micro.mch.bean.message.response.SubmitResultMessage;
import com.xnxkj.wx.micro.mch.excaption.WxMicroMchException;
import okhttp3.MediaType;

/**
 * 微信小微商户
 */
public interface IWxMicroMchService {
    String URL_HOST = "https://api.mch.weixin.qq.com";
    /**
     * 获取平台证书
     */
    String URL_GET_CERTIFICATES = "/risk/getcertficates";
    /**
     * 图片上传
     */
    String URL_UPLOAD_MEDIA = "/secapi/mch/uploadmedia";
    /**
     * 申请入驻
     */
    String URL_SUBMIT = "/applyment/micro/submit";

    /**
     * 查询申请状态
     */
    String URL_GET_STATE = "/applyment/micro/getstate";

    /**
     * 获取平台证书
     * https://api.mch.weixin.qq.com/risk/getcertficates
     */
    CertificatesResultMessage getCertificates() throws WxMicroMchException;

    /**
     * 图片上传
     * https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=19_9
     */
    MediaUploadResultMessage uploadMedia(String filename, MediaType mediaType, byte[] mediaContent) throws WxMicroMchException;

    /**
     * 申请入驻
     * https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=19_2
     * @param message 申请表单消息
     */
    SubmitResultMessage submit(SubmitMessage message) throws WxMicroMchException;

    /**
     * 查询申请状态
     * https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=19_3
     * @param stateMessage 查询消息
     */
    StateResultMessage getState(StateMessage stateMessage) throws WxMicroMchException;
}
